var assert = require('assert');
var search = require('business/search');
var business = require('business/business');



/*
 * Test search module
 */
search.search('http://www.focusitaly.net/wp-content/uploads/2013/05/angelina-jolie-1.jpg', search.FIND_GUESS, function(err, result) {
	
	//positive test
	try {
		assert.equal(result.findGuess.contains('angelina jolie'), true);
		console.log('positive search 1 ok');
	} catch (e) {
		console.log('positive search 1 problem: '+e);
	}
	
	//negative test
	try {
		assert.notEqual(result.findGuess.contains('brad jolie'), true);
		console.log('negative search 1 ok');
	} catch (e) {
		console.log('negative search 1 problem: '+e);
	}
	
	
});

/*
 * Test business module
 */
business.simpleBust({name:'angelina', surname:'jolie', imageURL: 'http://www.focusitaly.net/wp-content/uploads/2013/05/angelina-jolie-1.jpg'}, function(err, result, info) {
	
	//positive test
	try {
		assert.equal(result, false);
		assert.equal(info.findGuess.contains('angelina jolie'), true);
		console.log('positive simpleBust 1 ok');
	} catch (e) {
		console.log('positive simpleBust 1 problem: '+e);
	}
	
	
});

business.linkBasedBust({name:'angelina', surname:'jolie', imageURL: 'http://www.focusitaly.net/wp-content/uploads/2013/05/angelina-jolie-1.jpg'}, function(err, result, info) {
	
	//positive test
	try {
		assert.equal(result, false);
		console.log('positive linkBasedBust 1 ok');
	} catch (e) {
		console.log('positive linkBasedBust 1 problem: '+e);
	}
	
});

business.linkBasedBust({name:'angelina', surname:'ferrari', imageURL: 'http://www.focusitaly.net/wp-content/uploads/2013/05/angelina-jolie-1.jpg'}, function(err, result, info) {
	
	//negative test
	try {
		assert.equal(result, true);
		console.log('negative linkBasedBust 1 ok');
	} catch (e) {
		console.log('negative linkBasedBust 1 problem: '+e);
	}
	
	
});